package reversi;
/**
 * Jedynym celem istnienia tej klasy jest uruchamianie programu.
 * 
 * @author Sebastian Gabor
 *
 */

public class ReversiRunner {


	public static void main(String[] args) {
		
		ReversiConsoleEngine rce;
		
		try {
			rce = new ReversiConsoleEngine(8, 8);
			if (args.length==0){
				
				rce.play();
			}
			else if (args.length==3){
				if (args[0].startsWith("-c")){
					rce.setClient();
					rce.sendToServer("CREATE"+args[1]+";"+args[2]);
					rce.setGameNameAndPass(args[1], args[2]);
					rce.netPlay(false); 
					
					
				}
				else if (args[0].startsWith("-p")){

					rce.setClient();
					rce.setGameNameAndPass(args[1], args[2]);
					rce.netPlay(true);

					
				}
				
			}
			else if (args.length==1){
				if (args[0].startsWith("-s")){
					ReversiServer rs = new ReversiServer();
					rs.listen();
				}
			}
			
		}
			
		 catch (BoardException e) {
			e.printStackTrace();
		}


	}

}
